<?php
class TdRdbms {
	
	  var $instance;
	  var $config;
	  var $connection = null;
	  
	  function __construct($instance) {
  	
	  		global $teardrop;
	  	  
	  		$this->instance = $instance;
	  		
		  	if (isset($_SESSION['tdrdbms_'.$instance])) {
		
		  	  $this->config = $_SESSION['tdrdbms_'.$instance]->config;
		  	  $this->connection = $_SESSION['tdrdbms_'.$instance]->connection;
		  	
		  	} else {
		   	  
		  		if (empty($teardrop->config['db'][$instance])) {
		        	trigger_error("No database configuration found for instance: ".$instance, E_USER_ERROR);
		  	  	} else {
			  	    $this->config = $teardrop->config['db'][$instance];
			  	    $_SESSION['tdrdbms_'.$instance] = $this;
		  	  	}
		  	  
		  	}
	  	
	  }
  
}